trigger trg_Paid_Operations on Expense__c (before insert, before update) {
    List<Expense__c> incomingExpenses = Trigger.NEW;
    
    
    for(Expense__c e: incomingExpenses){

        if(e.Paid__c == True){
            e.Actual_Payment_Date__c = Date.Today();
            if(e.Recurring__c == True){
               e.Due_Date__c = e.Due_Date__c + Integer.valueOf(e.After_No_Of_Days__c);
               e.Paid__c = false;
            }   
        }
    }

}